<xsl:stylesheet version="2.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="text" encoding="UTF-8" indent="no"/>
    <!--
   Look at this page http://red-orange.cn/wiki/index.php/Messages_and_Constants for more information.
    -->
    <xsl:param name="language"/>
    <xsl:param name="defaultLanguage" select="en"/>

    <xsl:template match="/">

        <xsl:for-each select="//globals/enum">
            <xsl:variable name="attribute"><xsl:value-of select="@fieldName"/></xsl:variable>

            <xsl:for-each select="caption[@language=$language]">
                <xsl:choose>
                    <xsl:when test="@table">
<xsl:value-of select="$attribute"/>.table=<xsl:value-of select="@table"/>
<xsl:text>&#xa;</xsl:text>
                    </xsl:when>
                    <xsl:otherwise>
<xsl:value-of select="$attribute"/>.table=<xsl:value-of select="@form"/>
<xsl:text>&#xa;</xsl:text>
                    </xsl:otherwise>
                </xsl:choose>
<xsl:value-of select="$attribute"/>.form=<xsl:value-of select="@form"/>
<xsl:text>&#xa;</xsl:text>
            </xsl:for-each>

            <xsl:for-each select="*[child::caption[@language=$language]]">
                <xsl:variable name="value"><xsl:value-of select="@name"/></xsl:variable>
                <xsl:for-each select="caption[@language=$language]">
                    <xsl:choose>
                        <xsl:when test="@table">
<xsl:value-of select="$attribute"/>.<xsl:value-of select="$value"/>.table=<xsl:value-of select="@table"/>
<xsl:text>&#xa;</xsl:text>
                        </xsl:when>
                        <xsl:otherwise>
<xsl:value-of select="$attribute"/>.<xsl:value-of select="$value"/>.table=<xsl:value-of select="@form"/>
<xsl:text>&#xa;</xsl:text>
                        </xsl:otherwise>
                    </xsl:choose>
<xsl:value-of select="$attribute"/>.<xsl:value-of select="$value"/>.form=<xsl:value-of select="@form"/>
<xsl:text>&#xa;</xsl:text>
                </xsl:for-each>
            </xsl:for-each>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>